<template>
  <div class="sidebarBox">
    <div class="sidebar">
      <li style="--t:20%;">
        <a href="#">
          <i class="el-icon-menu"></i>
        </a>
      </li>
      <li style="--t:30%;">
        <a href="#">
          <i class="el-icon-camera"></i>
        </a>
      </li>
      <li style="--t:40%;">
        <a href="#">
          <i class="el-icon-message-solid"></i>
        </a>
      </li>
      <li style="--t:50%;">
        <a href="#">
          <i class="el-icon-user"></i>
        </a>
      </li>
      <li style="--t:60%;">
        <a href="#">
          <i class="el-icon-s-platform"></i>
        </a>
      </li>
      <li style="--t:70%;">
        <a href="#">
          <i class="el-icon-setting"></i>
        </a>
      </li>
      <div class="top"></div>
      <div class="middle"></div>
      <div class="bottom"></div>
    </div>
  </div>

</template>

<script>
export default {
  components: {},
  data () {
    return {

    };
  },
  watch: {},
  methods: {},
  created () { },
  mounted () { },
}
</script>
<style lang='less' scoped>
//@import url(); 引入公共css类
.sidebarBox {
  transform: translate(0, 0);
  height: 100%;
  background-color: #333;
  .sidebar {
    width: 12px;
    height: 500px;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #222;
    border-radius: 0 15px 15px 0;
    overflow: hidden;
    transition: 0.3s;
    .top {
      width: calc(100% - 30px);
      margin-left: 30px;
      height: 20%;
      background-color: #222;
      border-radius: 0 0 0 20px;
    }
    .middle {
      width: calc(100% - 60px);
      height: 10%;
      background-color: lightseagreen;
      margin-left: 40px;
      border-radius: 20px;
    }
    .bottom {
      width: calc(100% - 30px);
      height: 100%;
      margin-left: 30px;
      background-color: #222;
      border-radius: 20px 0 0 0;
    }
    li {
      position: absolute;
      top: var(--t);
      width: 100%;
      height: 10%;
      font-size: 30px;
      display: flex;
      justify-content: center;
      align-items: center;
      a {
        color: transparent;
        transition: 0.3s;
      }
    }
    li:nth-child(1):hover ~ .top {
      height: 20%;
    }
    li:nth-child(2):hover ~ .top {
      height: 30%;
    }
    li:nth-child(3):hover ~ .top {
      height: 40%;
    }
    li:nth-child(4):hover ~ .top {
      height: 50%;
    }
    li:nth-child(5):hover ~ .top {
      height: 60%;
    }
    li:nth-child(6):hover ~ .top {
      height: 70%;
    }
  }
  .sidebar:hover {
    width: 120px;
    border-radius: 0 30px 30px 0;
    li {
      a {
        color: #fff;
      }
    }
  }
  .sidebar::before {
    content: "";
    width: 50%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    background-color: lightseagreen;
  }
}
</style>